<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>14_RegExp-正则规则的集合</title>
</head>
<body>

  <script>
    // 手机号的规则: 1[3456789]033334444
    const phoneStarts = ["132", "130", "110", "120", "133", "155"]
    const phoneStartRe = /^1[3456789]\d/
    const filterPhone = phoneStarts.filter(phone => phoneStartRe.test(phone))
    console.log(filterPhone)

    // 邮箱的规则: 123456789@qq.com
    const emailRe = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/
    const email = "123456789@qq.com"
    console.log(emailRe.test(email))

    // 手机号码
    const phoneNum = "133888855555"
    const phoneNumRe = /^1[3456789]\d{9}$/
    console.log(phoneNumRe.test(phoneNum));

  </script>
  
</body>
</html>